﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Antioch.Base
{
    [Jemgine.Engine.Node, Jemgine.Engine.Category("Antioch System")]
    public class WeaponTest : Jemgine.Data.ScriptNode
    {
        
        public WeaponTest()
        {
            AddInput("Fire", null);
        }

        public override void FireTerminal(int InputID, Jemgine.Data.ScriptPayload Payload)
        {
            if (InputID == 0)
            {
                var GameState = Sim.GetModule<GameStateModule>();
                if (GameState == null) throw new InvalidOperationException(); //TODO : Exception for missing module.
                Jemgine.Data.EntityRecord PlayerEntity = GameState.Player;
                if (PlayerEntity == null) return;

                var Controller = PlayerEntity.GetComponent<PlayerController>();
                if (Controller == null) return;
                Controller.SelectedWeapon = new Pistol(Sim.EpisodeContent);
           }
        }
    }
}
